package com.gxa.service.impl;

import com.gxa.mapper.EchartsMapper;
import com.gxa.service.EchartsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Service层
 * 主要作用：业务逻辑处理
 *     日志、安全、事务......
 */
@Service // = new EchartsServcieImpl();
public class EchartsServcieImpl implements EchartsService {
    //调用Dao层
    @Autowired
    private EchartsMapper echartsMapper;

    @Override
    public Map findSalesDataByCreateTime(String createTime) {
        Map resultMap = new HashMap();
        try {
            //查询获得数据
            List<Map<String, Object>> resultData = echartsMapper.findSalesDataByCreateTime(createTime);
            //查询成功
            resultMap.put("code",200);
            resultMap.put("msg","success");
            resultMap.put("data",resultData);
        } catch (Exception e) {
            e.printStackTrace();
            resultMap.put("code",500);
            resultMap.put("msg","服务器开小差了，请联系管理员！");
        }
        return resultMap;
    }


}
